import os
import platform

sharedLibExt = 'so'

if platform.system() == 'Darwin':
	sharedLibExt = 'dylib'
	
def multiJar(target, source, env):
	jarFile = target[0];
	mode = "c"
	for s in source:
		jarCmd = "jar -%sf %s -C %s ." % (mode, jarFile, s)
		mode = "u"
		os.popen(jarCmd)

env = Environment(BUILDERS =
{
	'MultiJar' : Builder(action = multiJar)
})

# JAVACLASSPATH appears to be relative to the CWD, not the script file
env.Java(target='classes', source='src', JAVACLASSPATH=['stack/j2ee/lib/servlet-api.jar', 'babel/java/classes'])

env.MultiJar(target='phnq_stack.jar', source=[Dir('classes'), Dir('../../babel/java/classes')])
